import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:liuxlcommon/lget/lget.dart';
import 'package:liuxlcommon/view/extension_widget.dart';
import 'package:liuxlcommon/view/lxl_widget.dart';
import 'package:love_newf/app/page/message_list/conversation_list/conversation_list_view.dart';
import 'package:love_newf/app/page/message_list/friend_list/friend_list_view.dart';
import 'package:love_newf/value/app_colors.dart';
import 'package:love_newf/value/app_const.dart';

import 'message_list_logic.dart';

class MessageListPage extends StatefulWidget {
  const MessageListPage({Key? key}) : super(key: key);

  @override
  State<MessageListPage> createState() => _MessageListPageState();
}

class _MessageListPageState extends State<MessageListPage> {
  final MessageListLogic logic = Get.put(MessageListLogic());

  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 2, // 设置 Tab 数量
      child: Scaffold(
        body: LColumn.eazy([
          LSizeH(kToolbarHeight),
          TabBar(
            dividerHeight: 0,
            indicatorPadding: EdgeInsets.zero,
            padding: EdgeInsets.zero,
            isScrollable: false,
            indicatorColor: AppColors.primaryColor,
            labelStyle: TextStyle(
                color: 0xFF323232.color, fontSize: 20.w, fontWeight: fw6),
            unselectedLabelStyle:
                TextStyle(color: 0xFF868A98.color, fontSize: 16.w),
            tabs: const [
              Tab(text: '消息'), // Tab 1
              Tab(text: '好友'), // Tab 2
            ],
          ),
          LExpand(
              child: const TabBarView(
            children: [
              ConversationListPage(),
              FriendListPage(), // Tab 2 的内容
            ],
          ))
        ]).align(Alignment.topLeft),
      ),
    );
    ;
  }

  @override
  void dispose() {
    Get.delete<MessageListLogic>();
    super.dispose();
  }
}
